package org.example.service.impl;

import jakarta.annotation.Resource;
import org.example.entity.vo.response.MyDetailVO;
import org.example.mapper.CounterMapper;
import org.example.service.MyDetailService;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MyDetailServiceImpl implements MyDetailService {
    @Resource
    CounterMapper counterMapper;

    @Override
    public MyDetailVO getMyDetailVOByUserID(Integer id) {
        MyDetailVO myDetailVO = new MyDetailVO();
        Map<?, ?> map = counterMapper.getMyEXPAndDescribeByUserID(id);
        myDetailVO.setMyEXP((Integer) map.get("exp"));
        myDetailVO.setDescribe((String) map.get("a_describe"));
        myDetailVO.setMyFollowMessageCount(counterMapper.getMyFollowMessageCountByUserID(id));
        myDetailVO.setMyHistoryCount(counterMapper.getMyHistoryCountByUserID(id));
        myDetailVO.setMyReleaseForumCount(counterMapper.getMyReleaseForumCountByUserID(id));
        myDetailVO.setMyFollowForumCount(counterMapper.getMyFollowForumCountByUserID(id));
        return myDetailVO;
    }
    @Override
    public String getIconPathByUserID(Integer id) {
        return counterMapper.getIconPathByUserID(id);
    }
}
